package com.kingwang.training.ooad.coffeemaker.badway;

import com.kingwang.training.ooad.coffeemaker.hardware.api.BoilerStatus;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 加热器
 *
 * @author King
 */
@Component
public class Boiler {
    @Resource
    private BoilerSensor sensor;

    @Resource
    private BoilerHeater heater;

    public void on() {
        this.heater.on();
    }

    public void off() {
        this.heater.off();
    }

    public BoilerStatus getStatus() {
        return BoilerStatus.values()[this.sensor.sense()];
    }
}
